/*
 * @Author: muuzi@163.com muuzi@163.com
 * @Date: 2024-12-04 22:57:12
 * @LastEditors: muuzi@163.com muuzi@163.com
 * @LastEditTime: 2024-12-09 00:20:31
 * @FilePath: /mp-wechat/src/api/user.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// api/user.ts

import request from '@/utils/request';
enum Api {
  POST_LOGIN = '/auth/login',
  POST_LOGOUT = '/auth/logout',
  POST_WECHAT_OPENID='/auth/getWechatOpenId' 
}
//登录
export const login = (params: any) => {
    return request({
        url:Api.POST_LOGIN, 
        data:params,
        method:'POST'
    }).then((res: any) => {
        if (res.code === 200) {
            uni.setStorageSync('token', res.data.token);
        }
        return Promise.resolve(res);
    })
}
/**
 * 注销
 */
export function logout() {
    return request({
      url: Api.POST_LOGOUT,
      method: "POST",
    });
  }
  
// 获取微信openId
export function getWechatOpenId(data: any) {
    return request({
      url: Api.POST_WECHAT_OPENID,
      method: "POST",
      data,
    });
  }



